package com.ultrasoft.farmasoft.service;

import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.transaction.annotation.Transactional;

import com.ultrasoft.farmasoft.domain.Accountreceivable;
import com.ultrasoft.farmasoft.domain.Accountspayable;
import com.ultrasoft.farmasoft.domain.Client;
import com.ultrasoft.farmasoft.domain.Item;
import com.ultrasoft.farmasoft.domain.Operation;
import com.ultrasoft.farmasoft.domain.Package;
import com.ultrasoft.farmasoft.domain.Paymentplan;
import com.ultrasoft.farmasoft.domain.Pharmacy;
import com.ultrasoft.farmasoft.domain.Pharmacyproduct;
import com.ultrasoft.farmasoft.domain.Product;
import com.ultrasoft.farmasoft.domain.Transaction;
import com.ultrasoft.farmasoft.domain.Userpharmacy;
import com.ultrasoft.farmasoft.domain.Userprovider;

public interface BuyProductsTransactionService {
	public List<Package> getListPackage();
	public List<Package> getListPackageByActive(boolean active);
	public List<Package> getListPackageByPharmacyProductByActive(Pharmacyproduct pharmacyproduct,boolean active);
    public Package searchPackageByPackageId(Integer packageId);    
    public void updatePackage(Package packageElement);    
	public void updatePackageByListPackage(List<Package> listPackage);
    public void removePackage(Package packageElement);    
    public void addPackage(Package packageElement);
    
    
	public Pharmacyproduct searchPharmacyProductByPharmacyIdByProviderIdByProductId(Integer pharmacyId,Integer providerId, Integer productId);
	public void addPharmacyProduct(Pharmacyproduct pharmacyProduct);
	public void updatePharmacyProduct(Pharmacyproduct pharmacyProduct);
	
	
	public List<Item> getListItemByPackageId(Integer packageId);
	public Integer searchByItemIdMax(Integer packageId);
	public Item searchItemByPackageIdByItemId(Integer packageId, Integer itemId);
	public void updateItem(Item item);
	public void updateItemByListItem(List<Item> items);
	public void addItem(Item item);
	
	
	public List<Transaction> getListTransaction();
	public List<Transaction> getListTransactionByListPharmacyByStartDateByEndDate(List<Pharmacy> listPharmacy,Date start,Date end);
	public List<Transaction> getListTransactionByPharmacyIdByStartDateByEndDate(Integer pharmacyId,Date start,Date end);
	public List<Transaction> getListTransactionByPackageId(Integer packageId);
	public List<Transaction> getListTransactionByClientId(Integer clientId);
	public List<Transaction> getListTransactionByOperationId(Integer operationId);
	public List<Transaction> getListTransactionByPeriodIds(Integer periodIds);
	public List<Transaction> getListTransactionByTransactionId(Integer transactionId);
	public Transaction searchTransactionByPeriodIdsByTransactionId(Integer periodIds,Integer transactionId);	
	public Integer searchTransactionIdByPeriodIdsMax(Integer periodIds);
    public void removeTransaction(Transaction transaction);
    public void updateTransaction(Transaction transaction);
	public void addTransaction(Transaction transaction);
	
	
    public Operation searchByOperationId(Short operationId);    
    
    
	public List<Client> getListClientByPharmacyIdByActive(Integer pharmacyId,boolean active);
	public List<Client> getListClientByPharmacyIdByNitByActive(Integer pharmacyId,String nit,boolean active);
	public List<Client> getListClientByPharmacyIdByNameByActive(Integer pharmacyId,String name,boolean active);
    public void addClient(Client client);
    
	//public boolean addTransaction(HttpServletRequest request,Integer s_pharmacyId,List<Product> productList);
	public Client searchClient(HttpServletRequest request,Userpharmacy userPharmacy);		
	public boolean addTransaction(HttpServletRequest request,Integer s_pharmacyId,List<Product> productList,short userId);
	
	
	public List<Accountreceivable> getListAccountReceivable();
	public List<Accountreceivable> getListAccountReceivableByClientId(Integer clientId);
	public List<Accountreceivable> getListAccountReceivableByPharmacyIdByUserId(Integer pharmacyId,Integer userId);
	public void removeAccountReceivable(Accountreceivable accountReceivable);    
    public void updateAccountReceivable(Accountreceivable accountReceivable);
    public void addAccountReceivable(Accountreceivable accountReceivable);
    public Accountreceivable searchAccountReceivableByAccountReceivableId(Integer accountReceivableId);
    
    
    public List<Paymentplan> getListPaymentPlan();
	public List<Paymentplan> getListPaymentPlanByAccountsPayableId(Integer accountsPayableId);
	public List<Paymentplan> getListPaymentPlanByAccountReceivableId(Integer accountReceivableId);
	public void removePaymentPlan(Paymentplan paymentPlan);    
    public void updatePaymentPlan(Paymentplan paymentPlan);
    public void addPaymentPlan(Paymentplan paymentPlan);
    public Paymentplan searchPaymentPlanByPaymentPlanId(short paymentPlanId);
    
    
    public List<Accountspayable> getListAccountsPayable();
	public List<Accountspayable> getListAccountsPayableByProviderId(Integer providerId);
	public void removeAccountsPayable(Accountspayable accountsPayable);    
    public void updateAccountsPayable(Accountspayable accountsPayable);
    public void addAccountsPayable(Accountspayable accountsPayable);
    public Accountspayable searchAccountsPayableByAccountsPayableId(Integer accountsPayableId);
}
